<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>{$meta_title}[ 全部数量(<php>echo get_Ordernum($status,'order');</php>)]</h2>
	</div>

<div class="cf">
		<div class="fl">
			<a class="btn" href="{:U('add?status='.$status)}">新 增</a>
		 <button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>
		
		</div>

		<!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
				<div class="drop-down">
						<span id="sch-sort-txt" class="sort-txt" data="{$status}">
							<eq name="status" value="">所有</eq>
							<eq name="status" value="0">待支付</eq>
							<eq name="status" value="1">已支付</eq>
                            <eq name="status" value="2">已提交</eq></span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu" class="nav-list hidden">
						<li><a href="javascript:;" value="">所有</a></li>
<li><a href="javascript:;" value="0">待支付</a></li>
						<li><a href="javascript:;" value="1">已支付</a></li>
						<li><a href="javascript:;" value="2">已提交</a></li>
                        
					</ul>
				</div>
				<input type="text" name="out_trade_no" class="search-input" value="{:I('out_trade_no')}" placeholder="请输入订单号">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('Pay/index','&cate_id='.$cate_id,false)}"><i class="btn-search"></i></a>
			</div>
            <div class="btn-group-click adv-sch-pannel fl">
                <button class="btn">高 级<i class="btn-arrowdown"></i></button>
                <div class="dropdown cf">
                	<div class="row">
                		<label>更新时间：</label>
                		<input type="text" id="time-start" name="time-start" class="text input-2x" value="" placeholder="起始时间" /> -
                		<input type="text" id="time-end" name="time-end" class="text input-2x" value="" placeholder="结束时间" />
                	</div>
                	<div class="row">
                		<label>创建者：</label>
                		<input type="text" name="nickname" class="text input-2x" value="" placeholder="请输入用户名">
                	</div>
                </div>
            </div>
		</div>
	</div>

	<div class="data-table table-striped">
		 <table>
			<thead>
				<tr>
					<th class="row-selected">
					 <input class="checkbox check-all" type="checkbox">
					</th>
					<th>编号</th>
					<th>订单号</th>
                    <th>金额</th>
            
					 <th>付款方式</th>
                        <th>状态</th> 
						<th>用户昵称</th>
					   <th>创建时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="pay">
					<tr>
					<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$pay.id}"></td>
							<td>{$pay.id}</td>
						<td>  <a title="编辑" href="{:U('edit?id='.$pay['id'])}">{$pay.out_trade_no}</a></td>
				
						
                        <td>{$pay.money}</td>
                         <td>
                             <eq name="pay['type']" value="2">货到付款<else/>在线支付</eq></td>
						   <td> <eq name="pay['status']" value="1">支付成功</eq>
                            <eq name="pay['status']" value="2">提交成功</eq> </td>
						 <td>{$pay.uid|get_username}</td>
                         <td>{$pay.create_time|date='Y-m-d H:i:s',###}</td>
					<td> 
                            <a title="编辑" href="{:U('edit?id='.$pay['id'])}">编辑</a>
                            <a class="confirm ajax-get" title="删除" href="{:U('del?id='.$pay['id'])}">删除</a>
                        </td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
       
        <!-- 分页 -->
        <div class="page">
{$_page}
        </div>
	</div>
</block>

<block name="script">
  <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" status="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" status="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" status="text/css">
<script status="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script status="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script status="text/javascript">
     $(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query = 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

	//只有一个模型时，点击新增
	$('.document_add').click(function(){
		var url = $(this).attr('url');
		if(url != undefined && url != ''){
			window.location.href = url;
		}
	});

	//点击排序
	$('.list_sort').click(function(){
		var url = $(this).attr('url');
		var ids = $('.ids:checked');
		var param = '';
		if(ids.length > 0){
			var str = new Array();
			ids.each(function(){
				str.push($(this).val());
			});
			param = str.join(',');
		}

		if(url != undefined && url != ''){
			window.location.href = url + '/ids/' + param;
		}
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

    $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });

    $('#time-end').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });
})
            //导航高亮
            highlight_subnav('{:U('index')}');
     
    </script>
</block>